from wxpy import *
from weibo.WBPoster import WeiboSender
from weibo.WBFans import WeiboCommentUser
from weibo.WBComment import WeiboComment
from weibo.WBGroup import WeiboGroup
import time

# 1、发微博
# weibosender = WeiboSender()
# weibosender.send_weibo('你好！!')

# 2、评论
weiboComment = WeiboComment()
# weiboComment.send_comment('4171968175529234', "我微博有很多优惠券")

# 3、获取目标粉丝
weiboCommentUser = WeiboCommentUser()
fanses = weiboCommentUser.get_ones_fans('1879192935')
for fans in fanses:
    mid = weiboCommentUser.get_fans_first_post(fans.uid)
    if mid != None:
        weiboComment.send_comment(mid, "关注我送红包")
        time.sleep(60)

# 4、群聊
# group = WeiboGroup()
# groups = group.get_all_groups()
# for g in groups:
#     group.send_to_group(g, 'https://m.weibo.cn/status/4181348346262386')  ## 接口不可以

# 5、私信
# group = WeiboGroup()
# group.send_mess_to_one('2356812243', '我微博有很多优惠券')

# weiboCommentUser = WeiboCommentUser()
# group = WeiboGroup()
# fanses = weiboCommentUser.get_ones_fans('1879192935')
# for fans in fanses:
#     group.send_mess_to_one(fans.uid, '我微博有很多优惠券')
#     time.sleep(60)



